<?php $this->load->view('header') ?>

<div id="content">
<div class="column full fl">
		
		<div class="box">
		<div class="box-header">Rekam Medis Pasien</div>
		<div class="box-content box-table">
		<br />
		
		&nbsp;&nbsp;
		<?php if( get_data($uri_to_assoc,'from') == 'regBaru' ):?>
			<?php echo anchor('klinik/reportReg/regBaru', '<span class="icon_text preview"></span>Daftar Pasien Baru', 'class="button white"');?>
			
		<?php elseif( get_data($uri_to_assoc,'from') == 'regMember' ):?> 
			<?php echo anchor('klinik/reportReg/regMember', '<span class="icon_text preview"></span>Daftar Pasien Ulang', 'class="button white"');?>
			
		<?php else:?>
			<?php echo anchor('klinik/pasien/view', '<span class="icon_text preview"></span>Daftar Pasien', 'class="button white"');?>
			
		<?php endif;?> 
		<div class="clear"></div>
		
        	<?php if (isset($errorMessage)) : ?>
            	<div class="notification <?php echo ((isset($isSuccess) && $isSuccess) ? 'success' : 'error');?>"><?php echo $errorMessage; ?></div>
	        <?php endif; ?>    	
	        <br /><br />
	        
	        <table class="tablebox">
	        	<tr class='even'>
	        		<td width='100'>Kode RM</td>
	        		<td width='10'> : </td>
	        		<td><?php echo get_data($dataPasien,'pasienKode');?></td>
	        	</tr>
	        	<tr class='odd'>
	        		<td width='100'>Nama</td>
	        		<td width='10'> : </td>
	        		<td><?php echo get_data($dataPasien,'pasienNama');?></td>
	        	</tr>
	        	<tr class='even'>
	        		<td><br />Jns Kelamin</td>
	        		<td><br /> : </td>
	        		<td><br /><?php echo get_data($dataPasien,'pasienJenKel');?></td>
	        	</tr>
	        	<tr class='odd'>
	        		<td><br />Usia</td>
	        		<td><br /> : </td>
	        		<td><br /><?php echo getUsia($dataPasien['pasienTglLahir']);?></td>
	        	</tr>
	        	<tr class='even'>
	        		<td><br />No Telp</td>
	        		<td><br /> : </td>
	        		<td><br /><?php echo get_data($dataPasien,'pasienNoTelp');?></td>
	        	</tr>
	        	<tr class='odd'>
	        		<td><br />Alamat</td>
	        		<td><br /> : </td>
	        		<td><br /><?php echo get_data($dataPasien,'pasienAlamat');?></td>
	        	</tr>
	        </table>
	        <br /><br />
	        
            <?php echo $paging?>
            <table class="tablebox">
            <thead class="table-header" style="border-top:1px solid #ccc;border-bottom:1px solid #ccc">
                <tr>
                	<th width="10">No</th>
                    <th>RM Kode</th>
                    <th>Tanggal</th>
                    <th>Waktu</th>       
                    <th>Dokter</th>
                    <th>Total Biaya</th>
                    <th width="300">Action</th>
                </tr>
            </thead>
            <tbody>
            	<?php $no = get_data($uri_to_assoc,'page') + 1;?>
                <?php if ($dataView) foreach($dataView as $key=>$row) : ?>
                <?php $class = $no % 2 == 0 ? 'even' : 'odd' ?>
                <tr class=<?php echo $class?>>
                	<td><?php echo $no?></td>
                	
                	<td><?php echo get_data($row,'rmKode');?></td>
                	
                	<!-- Date -->
                	<?php if($key > 0):?>
                		<td><?php echo mydate($dataView[$key-1]['rmTglMulai']) == mydate($row['rmTglMulai']) ? '' : mydate($row['rmTglMulai'])?></td>
                	<?php else:?>
                    	<td><?php echo mydate($row['rmTglMulai'])?></td>
                    <?php endif;?>
                    
                    <td>
                    	<?php echo mytime($row['rmTglMulai']);?>
                    	
                    	<?php //echo get_data($row,'rmTglSelesai') != '0000-00-00 00:00:00' ? ' -- '.mytime($row['rmTglSelesai']) : '';?>
                    </td>
                    
                    <td><?php echo get_data($row,'dokterNama');?></td>
                    
                    <td>Rp. <span style="float:right;"><?php echo number_format( get_data($row,'rmTotalBiaya') )?></span></td>
		    <td>
                        <?php echo anchor('klinik/pasien/preview/pasienId/'.get_data($uri_to_assoc,'pasienId').'/id/'.$row['rmId'], '<span class="icon_text preview"></span>Payment', 'class="button white"');?>
		    </td>
                    
			<?php /* ?>
                    <td>
                        <?php //echo anchor('klinik/registrasi/proses/from/pasien/pasienId/'.get_data($uri_to_assoc,'pasienId').'/id/'.$row['rmId'], '<span class="icon_text save"></span>RM', 'class="button white"');?>
                        
                        <?php //echo anchor('klinik/registrasi/preview/from/pasien/pasienId/'.get_data($uri_to_assoc,'pasienId').'/id/'.$row['rmId'], 'cetak', 'class="button white"')?>
                    		
                        <?php //echo isAccess('klinik','rekammedis','delete') ? anchor('klinik/rekamMedis/view/pasienId/'.get_data($uri_to_assoc,'pasienId').'/action/delete/id/' . $row['rmId'],'<span class="icon_text cancel"></span>Hapus', array('onClick' => "return confirm('".$this->lang->line('global_confirm_delete')."')" , 'class' => "button white")) : ''?>
                    </td>
                    <?php */ ?>
                </tr>
                <?php $no++?>
                <?php endforeach;?>
            </tbody>
            </table>
            <div id="paging">
            <?php echo $paging?>
            </div>
		</div>
		</div>
	
	</div>
 
<?php $this->load->view('footer') ?>
